static char* _pos;

int strcmp( const char* str1, const char* str2 ) {
  int i; 
  for (i = 0; str1[i] && str2[i]; i++) {
    if (str1[i] != str2[i]) return str1[i]-str2[i];
  } 
  return str1[i]-str2[i];
} 

int atoi( const char* str ) {
  int n = 0, i;
  for (i = 0; str[i] >= '0' && str[i] <= '9'; i++) {
    n = (n*10)+(str[i]-'0');
  }
  return n;
}

char* strtok( char* str, char delim ) {
  if (str == NULL) str = _pos;
  if (!(*str)) return NULL;
  int i = 0;
  for (; str[i]; i++) {
    if (str[i] == delim) {
      str[i++] = '\0';
      break;
    }
  }
  _pos = str+i;
  return str;
}

void strinit() {
  _pos = NULL;
}
